<%@ page session="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

<h:panelGroup>
    <fieldset><legend><h:outputText value="Dane winietki"/></legend>
        <table width="100%" border="0">
            <tr>
                <td align="right">
                    <h:outputText value="Kod:"/>
                </td>
                <td width="30%">
                    <h:inputText styleClass="input_text" id="vignietteCode" value="#{vignietteBean.code}"
                                 title="Kod winietki" required="false"  maxlength="30"
                                 requiredMessage="Kod jest wymagany" style="width:100%;display:block;"/>
                    <h:message for="vignietteCode" styleClass="validation_info" />
                </td>

                <td align="right">
                    <h:outputText value="Cena jednostkowa:"/>
                </td>
                <td width="25%">
                    <h:selectOneListbox id="unitpriceList" styleClass="input_text" value="#{vignietteBean.unitprice}" size="1" required="true" requiredMessage="Cena jednostkowa za zaproszenie jest wymagana" style="width:100%;">
                        <f:selectItem itemLabel="brak" />
                        <f:selectItems value="#{ConstantDictionaries.priceTypes}" />
                    </h:selectOneListbox>
                    <h:message for="unitpriceList" styleClass="validation_info"/>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <h:outputText value="Całkowita ilość:"/>
                </td>
                <td width="30%">
                    <h:inputText styleClass="input_text" id="totalCount" value="#{vignietteBean.totalcount}"
                                 title="Całkowita ilość" required="false"
                                 requiredMessage="Całkowita ilość większa od 0" style="width:100%;display:block;">
                        <f:convertNumber integerOnly="true" />
                    </h:inputText>
                    <h:message for="totalCount" styleClass="validation_info" />
                </td>

                <td align="right">
                    <h:outputText value="Ilość z nadrukiem:"/>
                </td>
                <td>
                    <h:inputText styleClass="input_text" id="overprintCount" value="#{vignietteBean.overPrintCount}"
                                 title="Ilość z nadrukiem" required="false"
                                 requiredMessage="Ilość z nadrukiem musi być większa od 0" style="width:100%;display:block;">
                        <f:convertNumber integerOnly="true" />
                    </h:inputText>
                    <h:message for="overprintCount" styleClass="validation_info" />
                </td>
            </tr>
            <tr>
            <td align="right">
                    <h:outputText value="Uwagi:"/>
                </td>
                <td colspan="3">
                    <h:inputTextarea styleClass="input_text" cols="40" rows="4" value="#{vignietteBean.note}" title="Uwagi" style="width:100%;"/>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left">
                </td>
                <td colspan="2" align="right">
                    <tr:commandButton action="#{orderController.addVignietteToOrder}" rendered="#{empty vignietteBean.order}" text="Dołącz do zamówienia"/>
                    <tr:commandButton action="#{orderController.saveVignietteItem}" rendered="#{not empty vignietteBean.order}" text="Zapisz zmiany"/>
                </td>
            </tr>
        </table>

    </fieldset>
</h:panelGroup>